/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package wizard;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author afspear
 */
public class Player {
    protected int tired;
    protected boolean happiness;
    protected PlayerName name;
    protected  PlayerRole role;
    protected PlayerTransitiveVerb action;
    protected Objects possession;
    Logger log = new Logger("log.txt");

    public Player(PlayerName name) {
        this.name = name;
    }

    public boolean isHappy() {
        return happiness;
    }

    public void setHappiness(boolean happiness) {
        this.happiness = happiness;
    }

    public PlayerTransitiveVerb getAction() {
        return action;
    }

    public void setAction(PlayerTransitiveVerb action) {
        this.action = action;
    }

    public PlayerName getName() {
        return name;
    }

    public void setName(PlayerName name) {
        this.name = name;
    }

    public Objects getPossessions() {
        return this.possession;
    }

    public void setPossessions(Objects possession) {
        this.possession = possession;
        possession.setOwner(this);
    }

    public PlayerRole getRole() {
        return this.role;
    }

    public void setRole(PlayerRole role) {
        this.role = role;
    }

    public Player() {
    }

    public void tag(Player player){
    if (player.canBeCaught()) {
            if (this.role == PlayerRole.runner) {
                if (player.role == PlayerRole.servant) {
                    player.role = PlayerRole.runner;
                    this.moreTired();
                    player.moreTired();
                    
                    log.logAction("tag", this.name.toString(),player.name.toString());
                }
                
            } else if (this.role == PlayerRole.servant) {
                if (player.role == PlayerRole.runner) {
                    player.role = PlayerRole.servant;
                    this.moreTired();
                    player.moreTired();
                    log.logAction("tag", this.name.toString(),player.name.toString());
                }
                
            }
        }}
    
    public void find(Objects object){return;}

    public boolean canBeCaught(){return true;}
    
    public int getTired(){
        return tired;
    }
    
    public void moreTired(){
        tired++;
    }


}
